package com.example.demofdfs.model;

import java.util.Arrays;

public class ArrayTest {

	public static void main(String[] args) {
		
//		test1();
		int size = 0;
		Object[] objects = new Object[5];
		Object[] o = new Object[10];
		for (int i = 0; i < objects.length; i++) {
			objects[i] = new TestA((long)i);
			size++;
		}
		System.out.println(Arrays.toString(objects));
		int index = 0;
		System.arraycopy(objects, index, o, index + 1, size - index);
		System.out.println(Arrays.toString(o));
	}
	

	private static void test1() {
		Object[] objects = new Object[15];
		for (int i = 0; i < objects.length; i++)
			objects[i] = new TestA((long)i);
		
		System.out.println(Arrays.toString(objects));
		
		int index = 1;
		int size = 15;
		int moved = size - index - 1;
		System.arraycopy(objects, index + 1, objects, index, moved);
		System.out.println(Arrays.toString(objects));
		objects[--size] = null;
		System.out.println(Arrays.toString(objects));
		
		System.arraycopy(objects, index, objects, index + 1, size - index);
		System.out.println(Arrays.toString(objects));
		objects[index] = new TestA((long)1);
		System.out.println(Arrays.toString(objects));
	}

}
